package com.caipos.actor.common.actors;


import com.caipos.actor.common.data.EntityType;
import com.caipos.actor.common.msg.KbActorMsg;

import java.util.List;
import java.util.function.Predicate;
import java.util.function.Supplier;

public interface KbActorCtx extends KbActorRef {

    KbActorId getSelf();

    KbActorRef getParentRef();

    void tell(KbActorId target, KbActorMsg msg);

    void stop(KbActorId target);

    KbActorRef getOrCreateChildActor(KbActorId actorId, Supplier<String> dispatcher, Supplier<KbActorCreator> creator, Supplier<Boolean> createCondition);

    void broadcastToChildren(KbActorMsg msg);

    void broadcastToChildren(KbActorMsg msg, boolean highPriority);

    void broadcastToChildrenByType(KbActorMsg msg, EntityType entityType);

    void broadcastToChildren(KbActorMsg msg, Predicate<KbActorId> childFilter);

    List<KbActorId> filterChildren(Predicate<KbActorId> childFilter);
}
